	{{if $field_schema['formtype'] == 'file'}}
		<div class="form-group">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->MForm->swfupload($field,array('modelClass'=> $modelClass,'label'=>false,'div'=>false,'data_id'=>$data_id,'isadmin'=>false))}}
		    </div>
		</div>
	{{elseif $field_schema['formtype'] == 'hidden'}}
		      {{$this->Form->hidden($modelClass.'.'.$field)}}
	{{elseif $field_schema['formtype'] == 'checkbox'}}
		<div class="form-group form-inline">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->Form->input($modelClass.'.'.$field,array('type'=>'select','label'=>false,'div'=>false,'class'=>'form-control','after'=>$after))}}
		    </div>
		</div>
		
	{{elseif $field_schema['formtype'] == 'select'}}
		<div class="form-group form-inline">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->Form->input($modelClass.'.'.$field,array('class'=>'chzn-select select','label'=>false,'div'=>false,'class'=>'form-control','data-rel'=>'chosen','after'=>$after))}}
		    </div>
		</div>
		
	{{elseif $field_schema['formtype'] == 'textarea'}}
		<div class="form-group">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->Form->input($modelClass.'.'.$field,array('after'=>$after,'rows'=>'4','label'=>false,'div'=>false,'class'=>'form-control',))}}
		    </div>
		</div>
	{{elseif $field_schema['formtype'] == 'ckeditor'}}
		<div class="form-group" style="position:relative;">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->MForm->ckeditor($modelClass.'.'.$field,array('after'=>$after,'rows'=>'4','affix'=>false,'label'=>false,'div'=>false,'class'=>'form-control',))}}
		    </div>
		</div>	
	{{elseif $field_schema['formtype'] == 'date'}}
		<div class="form-group form-inline">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->Form->input($modelClass.'.'.$field,array('type'=>'text','after'=>$after,'label'=>false,'div'=>false,
		      	'data-date-format'=>"yyyy-mm-dd",'default'=>date('Y-m-d'),
		      'class'=>'form-control form-datepicker',))}}
		    </div>
		</div>
	{{elseif $field_schema['formtype'] == 'datetime'}}
		<div class="form-group form-inline">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->Form->input($modelClass.'.'.$field,array('after'=>$after,'label'=>false,'div'=>false,'class'=>'form-control',))}}
		    </div>
		</div>
	{{elseif $field_schema['formtype'] == 'number' || $field_schema['type']=='integer'}}
		<div class="form-group form-inline">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->Form->input($modelClass.'.'.$field,array('type'=>'number','after'=>$after,'label'=>false,'div'=>false,'class'=>'form-control',))}}
		    </div>
		</div>
	{{else}}
		<div class="form-group">
		    <label for="{{Inflector::camelize($modelClass.'_'.$field)}}" class="col-sm-2 control-label">{{__d('i18nfield', $modelClass.'_'.$field)}}</label>
		    <div class="col-sm-9">
		      {{$this->Form->input($modelClass.'.'.$field,array('type'=>'text','label'=>false,'div'=>false,'class'=>'form-control','after'=>$after))}}
		    </div>
		</div>		
	{{/if}}
	
	{{if $step_field_settings[$field] && $step_field_settings[$field]['associate']['associateelement'] && $step_field_settings[$field]['associate']['associatefield'] }}
		
		<script>
		$('#{{Inflector::camelize($modelClass.'_'.$field)}}').change(function(){
			
			var target_id = '{{Inflector::camelize ( $modelClass . '_' . $step_field_settings[$field]['associate']['associateelement'] )}}';
			
			
			if(this.value==""){
				$("#" + target_id).html("");
				$("#" + target_id).trigger("change");
				return false;
			}
			else{
				$("#" + target_id).after('<img id="'+target_id+'-loading" src="{{$this->Html->image('/img/ajax/circle_ball.gif',array('onlyurl'=>true))}}">');
			}
			$.ajax({
				type:"post", 
				dataType: "json",
				data:{"src_field":"{{$field}}","ass_field":"{{$step_field_settings[$field]['associate']['associateelement']}}","ass_val":this.value,"target_field":"{{$step_field_settings[$field]['associate']['associatefield']}}"},
				url:"{{$this->Html->url ( '/flowsteps/getFieldOptions/'.$step_id )}}",
				success: function(data){
					$('#'+ target_id +'-loading').remove();
	                $("#" + target_id).html(data.option_html);
	                $("#" + target_id).trigger("change");
				}
			});
			
		}).trigger('change');
		</script>
	
	{{/if}}